package com.lblin.web;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.catalina.session.StandardSessionFacade;
import org.apache.tomcat.util.http.fileupload.servlet.ServletRequestContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.lblin.tio.client.HelloClientStarter;
import com.xiaoleilu.hutool.crypto.SecureUtil;
import com.xiaoleilu.hutool.crypto.symmetric.SymmetricAlgorithm;
import com.xiaoleilu.hutool.crypto.symmetric.SymmetricCrypto;
import com.xiaoleilu.hutool.util.CharsetUtil;


/**
 * Hello world!
 *
 */

@SpringBootApplication
@RestController
public class App 
{
	
    public static void main( String[] args ) throws Exception
    {
    	
        SpringApplication.run(App.class, args);
        
        //启动tio client
        //HelloClientStarter.main(args);
    }
    
    
    @RequestMapping("ceshi")
    public String ceshi(HttpServletRequest request,HttpServletResponse response,String hello) throws Exception{
    	
    	String jid1 = request.getRequestedSessionId();
    	HttpSession session = request.getSession();
    	String sessionId = session.getId();
    	String isNew = String.valueOf(session.isNew());
    	String jid2 = request.getRequestedSessionId();
    	
//    	String result = "";
//    	try {
//    		result = HelloClientStarter.send(hello,request.getSession().getId());
//		} catch (Exception e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
		return "jid1:"+jid1+"sessionId:"+sessionId+"isNew:"+isNew+"jid2:"+jid2;
    }
    
}
